﻿@model IEnumerable<ISS.Models.Images>
@{
    ViewBag.Title = "Index";
}


<div style="position:relative;">
@{
    int totalImage = Model.Count();
    
    int itemPerColumn = (totalImage / 3) + 1;

    int itemPlus = totalImage - (itemPerColumn * 3);
    
    int currentItem = 0;

    int currentColumn = 1;
    
    <table>
        <tr valign="top">
        
    @foreach (ISS.Models.Images image in Model)
    {
        if(currentItem == 0)
        {
            WriteLiteral("<td valign=\"top\">");
        }
        <div class="pin" >
            <a href="@Url.Action("MyAlbum", "Image", new { ID = image.ImageId })"> 
                <img src='@Url.Content("~" + image.ImageThumbnail)' />
            </a>
            <div>
                <a class="album-name" href="@Url.Action("MyAlbum", "Image", new { ID = image.ImageId })">
                    @image.Title
                </a>

                <a href=''>Sửa tiêu đề</a>
            </div>

            <div>
                <span><img src='@Url.Content("/Content/Images/like.jpg")' /> <b>@image.Like</b></span>
                <span><img src='@Url.Content("/Content/Images/view.jpg")' /> <b>@image.ViewCount</b></span>
            </div>

            <div class="select">
                @Html.CheckBox("chkItem_" + image.ImageId)
            </div>
        </div>
        
        currentItem++;
        if (currentItem >= itemPerColumn)
        {
            
            WriteLiteral("</td>");
            currentItem = 0;
            currentColumn++;
        }
        //Write(album.AlbumName);    
    }

        </tr>
    </table>
}
</div>